package org.example.swagger01.controller;

import io.swagger.annotations.*;
import org.example.swagger01.anno.MyAnnotation4Swagger;
import org.example.swagger01.entity.MyEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

/**
 * @author admin
 * @version 1.0.0
 * @ClassName MyController.java
 * @Description TODO
 * @createTime 2021年04月17日 10:03:00
 */
@RestController
@Api(
        tags = {"MyController","Swagger学习控制器"} //一个别名显示一个控制器 类似重复显示
)
public class MyController {

    @GetMapping("/get")
    @ApiOperation(
            value = "get方法执行数据查询操作",//显示的位置不同
            notes = "数据查询方法")
    public String get(){
        return "get";
    }

//    @MyAnnotation4Swagger
    @RequestMapping("/req")
    public String req(@ApiParam(name = "用户名(m)",value = "新增用户提供",required = true) String m){
        return "req";
    }
    @ApiIgnore //忽略 不生成文档
    @PostMapping("/post")
    public String post(String m){
        return "post";
    }

    @ApiImplicitParams({
            @ApiImplicitParam(name = "a",value = "参数a",required = true,paramType = "字符串"),
            @ApiImplicitParam(name = "b",value = "参数b",required = false,paramType = "字符串"),
    }

    )
    @GetMapping("/test")
    public String test(String a,String b){

        return "test";
    }
    @GetMapping("/gete")
    public MyEntity getEmti(){

        return new MyEntity();
    }
    @PostMapping("/save")
    public MyEntity postEnt(MyEntity in){

        return in;
    }

}
